Fix the any_scan.h value-param findings caused by #272 - #278
Merged
Conversation
#272 changed AnyScanImpl's constructors to take MakeAnyScanData by const reference. That silently broke the three public wrappers - AnyScan, ConstScan and ConvertingScan - which take the same type BY VALUE and then `std::move(data)` into AnyScanImpl. Moving into a const& parameter is a no-op, so those moves became misleading dead code and the by-value parameters became "copied but only used as a const reference". The finding count went from 25 (at the impl constructor) to 45 (at the three wrappers): my verification for #272 confirmed the specific diagnostic cleared without re-measuring the file, so the regression went unnoticed. Make the three wrappers take a const reference too and drop the pointless `std::move`. That is consistent with the type: 16 bytes holding one const shared_ptr, whose const member makes even a move a copy. performance-unnecessary-value-param now reports zero for the header. bazel test --config=clang //... - 109/109 pass. Signed-off-by: helly25 <6420169+helly25@users.noreply.github.com>
helly25
enabled auto-merge (squash)
August 9, 2026 08:29
Fab-Cat
approved these changes
Aug 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clears all 45
performance-unnecessary-value-paramfindings inmbo/container/any_scan.h— 10% of everything remaining.This is a regression I introduced in #272
#272 changed
AnyScanImpl's constructors to takeMakeAnyScanDataby const reference. That silently broke the three public wrappers —AnyScan,ConstScan,ConvertingScan— which take the same type by value and thenstd::move(data)intoAnyScanImpl:Moving into a
const¶meter does nothing, so thosestd::movecalls became misleading dead code and the by-value parameters became "copied for each invocation but only used as a const reference".The count went 25 → 45: the findings moved off the impl constructor and onto the three wrappers, and multiplied. My verification for #272 confirmed the specific diagnostic cleared but never re-measured the file, so this went unnoticed until the enforcement sweep.
Fix
Make the three wrappers take a const reference too, and drop the pointless
std::move. Consistent with the type: 16 bytes holding oneconst std::shared_ptr, whoseconstmember makes even a move a copy (measured in #272).Test
performance-unnecessary-value-paramreports zero for the header (was 45).bazel test --config=clang //...— 109/109 pass.pre-commit run -agreen.Remaining in this header, for later PRs:
readability-redundant-typename(5),cppcoreguidelines-rvalue-reference-param-not-moved(3), and single findings from three other checks.